<template>
	<view class="content">
		<view class="passwordform">
			<u--form labelPosition="left" ref="uForm">
				<u-form-item label="结算方式" prop="" labelWidth="80px" class="itemform">
					<u--input v-model="modCarData.bank_type == 1 ? '银行卡' : '电子银行'" border="none" :disabled="true" placeholder="请输入密码" style="text-align: right;" ></u--input>
				</u-form-item>
				<u-form-item label="账号" prop="" labelWidth="80px" class="itemform">
					<u--input v-model="modCarData.banknumber" border="none" :disabled="true" placeholder="请确认账号" ></u--input>
				</u-form-item>
				<u-form-item label="姓名" prop="" labelWidth="80px" class="itemform">
					<u--input v-model="modCarData.busername" border="none" :disabled="true" placeholder="请输入姓名" ></u--input>
				</u-form-item>
				<u-form-item label="银行名称" prop="" labelWidth="80px" class="itemform">
					<u--input v-model="modCarData.bankname" border="none" :disabled="true" placeholder="请输入银行名称" ></u--input>
				</u-form-item>
				<u-form-item label="开户支行" prop="" labelWidth="80px" class="itemform">
					<u--input v-model="modCarData.branch" border="none" :disabled="true" placeholder="请输入开户支行" ></u--input>
				</u-form-item>
				<u-form-item label="出售金额" prop="sellMoney" labelWidth="80px" class="itemform" style="border: #e48b6b solid 1px;border-radius: 15rpx;">
					<u--input v-model="modCarData.sellMoney" border="none" placeholder="请输入出售金额数额" ></u--input>
					<text style="padding-right: 100rpx;padding-left:50rpx;border-left: #c5c5c5 solid 1px;">USDT</text>
				</u-form-item>
			</u--form>
			<view class="form_sub">
				<view class="sub_txt"><text>已选押金数额</text><text>0</text></view>
				<view class="sub_txt"><text>平台服务费(2%)</text><text>0.00</text></view>
				<view class="sub_txt"><text>可用接单金额</text><text>0.00</text></view>
			</view>
			<view class="colltitle">USDT搬砖收益说明:</view>
			<view class="form_txt">1、银行卡押金匹配订单金额;</view>
			<view class="form_txt">2、自动匹配接近金额;</view>
			<view class="form_txt">3、平台收取2%服务费;</view>
			<view class="form_txt">4、匹配模式收益根据市场行情在10-20%以上不等，最低收益10%以上;</view>
			<view class="form_txt">5、邀请好友卖USDT可额外赚取好友所产生平台收益一级30%,二级15%，级5%收益。</view>
			<u-button type="primary" text="立即付款" color="#53c393" style="margin-top: 20rpx;" @click="copyMoney"></u-button>
			<u-button type="primary" text="删除收款方式" color="#f9855c" style="margin-top: 10rpx;" @click="Delcollection"></u-button>
			<u-button type="primary" text="押金退回" color="#f9855c" style="margin-top: 10rpx;" @click="returnClick"></u-button>
		</view>
		
		<u-modal :show="copyShow" :showCancelButton="true" @cancel="confirmCancel" @confirm="confirmClick" confirmText="确定" cancelText="取消">
			<view class="slot-content">
				<rich-text :nodes="content">
					<img src="../../static/common/warning_icon.png" alt="">
				</rich-text>
			</view>
		</u-modal>
		
		<u-toast ref="uToast"></u-toast>
		<botLine />
	</view>
</template>

<script>
	import botLine from '../../components/botLine.vue'
	export default {
		components:{
			botLine
		},
		data() {
			return {
				modCarData:{},
				rules:{},
				cookVal : null,
				copyShow : false,
				content : '<img src="../../static/common/warning_icon.png" alt="" style="width:72px;height:72px;display:block;margin:0 auto;"><br/>是否确认删除该结算方式，剩余的押金直接退回您的钱包'
			}
		},
		onLoad() {
			console.log('回来了')
			this.cookVal = JSON.parse(localStorage.getItem("cookies"))
			// this.infoDataObject.uid = cookies&&cookies[0].uid;
			this.cardlistFn(this.cookVal&&this.cookVal[0].uid);
		},
		methods: {
			copyMoney(v){
				if(this.modCarData.sellMoney == ''){
					this.$refs.uToast.show({type: 'default',title: '默认主题',message: "请输入出售金额数额"})
					return
				}
				let infoDataObject = JSON.parse(sessionStorage.getItem('infoDataObject'));
				infoDataObject.p_usdt = this.modCarData.sellMoney;
				console.log(infoDataObject)
				uni.request({
					url:'/index/api/add_order',
					method:'post',
					data:infoDataObject,
					success:res=>{
						console.log(res)
						this.$refs.uToast.show({type: 'default',title: '默认主题',message: res.data.msg})
					}
				})
			},
			confirmClick(){
				this.copyShow = false;
				uni.request({
					url:'index/api/del_card',
					method:'post',
					data:{uid:this.cookVal&&this.cookVal[0].uid,bid:this.$route.query.bid},
					success:res=>{
						// uni.navigateTo({
						//     url:`/pages/modcollection/index?pid=${this.$route.query.pid}`
						// });
						uni.navigateBack({
							delta:1,//返回层数，2则上上页
						})
					}
				})
			},
			Delcollection(){this.copyShow = true;},
			confirmCancel(){this.copyShow = false;},
			// 退还押金
			returnClick(){
				uni.request({
					url:'/index/api/back_card',
					method:'post',
					data:{uid:this.cookVal&&this.cookVal[0].uid,bid:this.$route.query.bid},
					success:res=>{
						this.$refs.uToast.show({type: 'default',title: '默认主题',message: res.data.msg})
					}
				})
			},
			// 接口
			// 获取卡片接口
			cardlistFn(uid){
				let _this = this
				uni.request({
					url:'/index/api/get_cardlist',
					method:'post',
					data:{uid:uid},
					success:res=>{
						let bid = _this.$route.query.bid
						console.log(bid)
						res.data.info.map((item,inx)=>{
							if(item.bid == bid){
								this.modCarData = item;
							}
						})
						this.modCarData.sellMoney = '';
						console.log(this.modCarData)
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.content{padding:0 20rpx ;
	background-color: #f1f5f8;
	.passwordform{
		padding-top: 20rpx;padding-bottom: 80rpx;
		.itemform{
			background-color: #fff;padding: 0 10rpx;margin-bottom:20rpx;font-weight: 400;
		}
		/deep/.uni-input-input{text-align: right;}
	}
	.form_sub{
		background: #fff;border-radius: 15rpx;padding: 10rpx 0;
		.sub_txt{
			display: flex;padding: 0 20rpx;line-height: 50rpx;font-size: 26rpx;
			text:nth-child(1){
				color: #9b9b9b;flex: 1;
			}
			text:nth-child(2){
				color: #000;text-align: right;
			}
		}
	}
	.colltitle{
		color: #000;font-size: 30rpx;padding:20rpx 0 10rpx 0;
	}
	.form_txt{
		font-size: 24rpx;color: #94989b;line-height: 46rpx;
	}
	
	
	
	
	
	
	.login_btn{background-color: $btnColor;border: $btnColor solid 1px;width:95%;margin:100rpx auto 0;}
}
</style>